<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //间隔函数：每隔多长时间执行以下
        // setInterval(function(){
        //     console.log(new Date())
        // },1000);

        //延迟函数:一秒钟后执行此行数。
        let timeoutInt = 0 ;
        function getTime(){
            console.log(new Date());
            timeoutInt = setTimeout(getTime, 1000);
        }
        getTime();
        //清除定时器
        //clearTimeout(timeoutInt);
    </script>
</body>
</html>